
<script src="web/assets/plugins/jquery-validation/js/jquery.validate.min.js" type="text/javascript"></script>
<div class="clearfix"></div>
<div class="content">  

    <!-- Modal -->
    <div class="modal fade" id="myModalSectorADD" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <br>
                    <i class="icon-credit-card icon-7x"></i>
                    <h4 id="myModalLabel" class="semi-bold">Sector</h4>
                    <p class="no-margin"> </p>
                    <br>
                </div>

                <div class="modal-body">
                    <form  action="./fuentes/controller/Sector.php" id="formSector" name="formSector" autocomplete="off" > 
                        <?php require_once '/FormSector.php'; ?>
                       
                    </form>    
                </div>
                <!-- /.modal-content -->
            </div>
            <!-- /.modal-dialog -->
        </div>
        <!-- /.modal -->
    </div>

    <div class="row" id="movimiento">
        <div class="col-md-12">
            <div class="grid simple ">
                <div class="grid-title no-border">
                    <h4><span class="semi-bold">Listado de Sectores</span></h4>
                    <button style="float: right;" class="btn btn-success btn-xs " id="agregar" data-toggle="modal"  data-target="#myModalSectorADD"> Agregar</button>
                    <div class="labelRight" id="error">	

                    </div>
                </div>
                <div class="grid-body no-border">

                    <table class="table table-hover no-more-tables table-condensed  " id="sectorTABLE">
                        <thead>
                            <tr>
                                <th style="width:1%" >ID</th>
                                <th style="width:18%">Nombre </th>
                                <th style="width:10%">Icono </th>
                                <th style="width:18%">Sucursales </th>
                                <th style="width:12%">IP </th>

                                <th class="center" style="width:12%">Accion</th>
                            </tr>
                        </thead>
                        <tbody id="sectorList">

                            <?php
                            if($sectores) {
                                foreach ($sectores as $dato) {
                                    echo "<tr>
                                           <td>" . $dato["id"] . "</td>
                                           <td>" . $dato["nombre"] . "</td>
                                           <td>
                                                <div class='cbp_tmicon primary animated bounceIn'> 
                                                     <i class='fa " . $dato["icon"] . "'></i>
                                                </div>
                                           </td>
                                           <td>";
                                                        foreach ($sucursales as $datoS) {
                                                            if ($dato["sucursal_id"] == $datoS["id"]) {
                                                                echo $datoS["nombre"];
                                                            }
                                                        }
                                                        echo "      </td>
                                            <td>" . $dato["ip"] . "</td>
                                            <td>
                                                <button class='btn btn-success btn-xs btn-mini' onclick='editDatos(" . $dato["id"] . ")' title='Editar' ><i class='fa fa-pencil'></i></button>&nbsp;&nbsp;
                                                <button class='btn btn-success btn-xs btn-mini' onclick='eliminarDato(" . $dato["id"] . ")' title='Eliminar' ><i class='fa fa-times'></i></button>&nbsp;&nbsp;
                                                <button class='btn btn-success btn-xs btn-mini' onclick='movimiento(" . $dato["id"] . ")' title='Respuestas' ><i class='fa fa-random'></i></button>
                                            </td>
                                     </tr>";
                                }
                            } else {
                                  echo "<tr><td colspan='5' class='text-center'><h4> No existen Registros </h4></td></tr>";
                            }
                            ?>


                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="./fuentes/view/sector/js/script_ajax_sector.js" type="text/javascript"></script>



